package com.sthz.facepay.mapper;

import com.sthz.facepay.model.Point;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface PointMapper {
    @Delete({
        "delete from st_point",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into st_point (id, consume_point, ",
        "gift_point)",
        "values (#{id,jdbcType=INTEGER}, #{consume_point,jdbcType=INTEGER}, ",
        "#{gift_point,jdbcType=INTEGER})"
    })
    int insert(Point record);

    @InsertProvider(type=PointSqlProvider.class, method="insertSelective")
    int insertSelective(Point record);

    @Select({
        "select",
        "id, consume_point, gift_point",
        "from st_point",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="consume_point", property="consume_point", jdbcType=JdbcType.INTEGER),
        @Result(column="gift_point", property="gift_point", jdbcType=JdbcType.INTEGER)
    })
    Point selectByPrimaryKey(Integer id);

    @UpdateProvider(type=PointSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Point record);

    @Update({
        "update st_point",
        "set consume_point = #{consume_point,jdbcType=INTEGER},",
          "gift_point = #{gift_point,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Point record);
}